package com.atguigu.yygh.order.receiver;

import com.atguigu.yygh.order.service.OrderInfoService;
import com.atguigu.yygh.rabbit.config.MQConst;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA
 *
 * @Date: 2023/1/8 - 15:58
 * @Author: Hyoung
 * @Description:
 */


@Component
@Slf4j
public class OrderReceiver {

    @Autowired
    private OrderInfoService orderInfoService;

    @RabbitListener(bindings = @QueueBinding(  //定义连接对象
            value = @Queue(value = MQConst.QUEUE_TASK_8, durable = "true"), //定义队列 并持久化
            exchange = @Exchange(value = MQConst.EXCHANGE_DIRECT_TASK),  //定义交换机
            key = {MQConst.ROUTING_TASK_8}  //定义路由
    ))
    public void patientTips() {
        log.info("OrderReceiver发送就诊提醒");
        orderInfoService.patientTips();
    }
}
